<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ include file="/page/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>${AppBaseInfo.appName}</title>
<%@ include file="/adapter/adapter-bootstrap.jsp" %>
<script type="text/javascript"><!--
var tempid="";
     function vailId()
            {
               tempid=document.getElementById("appId").value;
               tempid=tempid.replace(/(^\s*)|(\s*$)/g, ""); 
              if(tempid == null || tempid== undefined || tempid == '')
              {
                 alert("移动应用标识不能为空");
                 return;
              }
              if(escape(tempid).indexOf("%u")>0)
              {
            	  alert("移动应用标识不能包含特殊字符");
            	  document.getElementById("appId").value="";
      	        document.getElementById("appId").focus();
             } else{
            	  ajaxRequest();
              }    	         
	         
            }
     function ajaxRequest() {
    	    $.ajax({
    	      url: "${pageContext.request.contextPath }/appBaseInfo/findid?appid='"+tempid+"'",
    	      type: "POST",
    	      dataType: "json",
    	      async: false,
    	      success: function(data) {  
        	      var jspstate=data.model.idflag;
        	      if(jspstate==9999){
        	    	  alert("系统异常请联系管理员");
            	      }
        	      if(jspstate!=0 && jspstate!=9999){
        	    	    alert("移动应用标识已存在");
          	           document.getElementById("appId").value="";
          	            document.getElementById("appId").focus();
            	      }  
    	      },
    	      error: function() {    	        
    	        alert("error");
    	      }
    	    });
    	  }
     function save(){
         /* if(tempid == null || tempid== undefined || tempid == ''){
        	  alert("移动应用标识不能为空");
	          document.getElementById("appId").value="";
	          document.getElementById("appId").focus();
    	 
           }else{

          	   $.ajax({
        			type:'post',
        			url:'${pageContext.request.contextPath }/appBaseInfo/addAppBaseInfo',
        		    dataType: "json",
        		    data:$("#baseinfo").serialize(),
        		    async: false,
        			success:function(data){//返回json结果
            			var addstate=data.model.addflag;
            			if(addstate==0){
            				alert("新增应用失败!");
            			}else{
            				alert("新增应用成功!");
            				//window.location.href="${pageContext.request.contextPath }/appBaseInfo/queryList";
            				try{
            					opener.document.location.reload(true);
            				} catch(e){

                			}
            				window.close();
                		}
        			}
        			
        		});
        	 
               }*/
     }

--></script>
</head>
<body>
<div class="panel panel-default ">
   <div class="panel-heading">
      <h3 class="panel-title">
          应用编辑
      </h3>
   </div>
   <div class="panel-body">
<form class="form-horizontal" role="form" id="baseinfo" name="baseinfo"  action="${pageContext.request.contextPath }/appBaseInfo/addAppBaseInfo" method="post">
                    <fieldset>
                       <div class="form-group">
                          <label class="col-xs-2 control-label" for="ds_host">移动应用标识</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="appId" name="appId" type="text"  value="${AppBaseInfo.appId}" readonly/> 
                          </div>
                          <label class="col-xs-2 control-label" for="ds_name">移动应用名称</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="appName" name="appName" type="text" value="${AppBaseInfo.appName}"/>
                          </div>
                       </div>
                       <div class="form-group">
                          <label class="col-xs-2 control-label" for="ds_username">当前版本号</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="appVersionId" name="appVersionId" type="text" value="${AppBaseInfo.appVersionId}"/>
                          </div>
                          <label class="col-xs-2 control-label" for="ds_password">发布版本日期</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="appVersionDate" name="appVersionDate" type="text" value="${AppBaseInfo.appVersionDate}"/>
                          </div>
                       </div>
                       <div class="form-group">
                          <label class="col-xs-2 control-label" for="ds_username">应用状态</label>
                          <div class="col-xs-4">
                              <select id="appState" name="appState" class="form-control">
                              <option value="1">正常</option>
                               <option value="2">下线</option>
                              </select>
                          </div>
                          <label class="col-xs-2 control-label" for="ds_password">应用工程状态</label>
                          <div class="col-xs-4">
                             <input class="form-control"  type="text" id="remarks" name="remarks" value="${AppBaseInfo.appProjectState}">
                          </div>
                       </div>                       
                       <div class="form-group">
                          <label class="col-xs-2 control-label" for="ds_username">应用工程地址</label>
                          <div class="col-xs-10">
 									 <input class="form-control" id="appVersionId" name="appVersionId" type="text" value="${AppBaseInfo.appProjectUrl}"/>
                          </div>
                       </div>
                       <div class="form-group">   
                          <label class="col-xs-2 control-label" for="ds_password" >备注</label>
                          <div class="col-xs-10">
                             <textarea  class="form-control" id="remarks" name="remarks" rows="3">${AppBaseInfo.remarks}
                             </textarea>
                          </div>
                       </div>
                    </fieldset>     
                    <br></br>

					<div class="form-group">
						<div class="col-xs-5"></div>
						<div class="col-xs-5">
							<button type="button" class="btn btn-default" onclick="save()">&nbsp;&nbsp;确定&nbsp;&nbsp;</button>
							<button type="button" class="btn btn-default"  onclick="window.close()">&nbsp;&nbsp;关闭&nbsp;&nbsp;</button>
						</div>
					</div>
                    <br></br>
                </form>
	</div>
	</div>
</body>
</html>
